
var errorMsg = document.getElementById('errorBox').innerText
var min_list = document.getElementById('min_list') // 搜索有结果
var errorBox = document.getElementById('errorBox') // 错误弹窗
var unresult = document.getElementById('unresult') // 搜索结果为空
function getQueryVariable(variable)
{
	var query = window.location.search.substring(1);
	var vars = query.split("&");
	for (var i=0;i<vars.length;i++) {
			var pair = vars[i].split("=");
			if(pair[0] == variable){return pair[1];}
	}
	return(false);
}
function searchAction(){
	var searchname = document.forms["searchForm"]["title"].value;
	if(searchname ==''){
		document.getElementById('errorBox').innerText = "搜索内容不能为空"
		errorBox.style.display = "block"
		window.setTimeout("alertMsg()",2000)
		unresult.style.display = "block"
		min_list.style.display = "block"
		document.getElementById('searchName').innerText = searchname
	} else {
		window.location.href="/msearch?title="+searchname;
		
	}
}

function ifLisType(){
	var title = getQueryVariable('title');
		if(title){
			var liNums = $("#lisNum li")
			if(liNums.length <1){
				unresult.style.display = "block"
			}else{
				min_list.style.display = "block"
			}
		}
}

ifLisType();
function alertMsg(){
	errorBox.style.display = "none"
	document.getElementById('errorBox').innerText = "搜索内容不能为空"
}
